<!DOCTYPE html>
<html lang="zh">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title>机构端</title>
		<script src="/Public/static/jquery-2.0.3.min.js"></script>
        <link rel="stylesheet" href="__PUBLIC__/Home/css/reset.css">
        <link rel="stylesheet" href="__PUBLIC__/Home/css/style.css">
	</head>

	<body class="agency_box contentBox pos_rel dpflxr">
		<include file="head" />

		<!-- 2.垂直导航 -->
		<div class="navColumn">
			<a href="{:U('Mechanism/user_list')}" <if condition="$cur eq '用户管理'">class="navColumnItem actived dpflxr pos_rel"<else />class="navColumnItem  dpflxr pos_rel"</if> data-type='1'>
				<div class="lineColumn pos_abs"></div>
				<label for="">用户管理</label>
				<div class="rightArrow">
				</div>
			</a>
			<a href="{:U('Mechanism/agent')}" <if condition="$cur eq '经纪人管理'">class="navColumnItem actived dpflxr pos_rel"<else />class="navColumnItem  dpflxr pos_rel"</if>  dpflxr pos_rel" data-type='2'>
				<div class="lineColumn pos_abs"></div>
				<label for="">经纪人管理</label>
				<div class="rightArrow">
				</div>
			</a>
			
			
		</div>
		<!-- 3.垂直导航分类页面 -->
	
		<!-- 3.1 新增经纪人  -->
		<div class="contentArea tabPage actived">
			
			<!-- 3.3.1 新增经纪人 -->
			<div id="appendEmployee" >
				
				<div class="caTitleBox dpflxr">
					<label for="" class="caTitle">新增经纪人</label>	
				</div>
				<form action="" method="POST">
					<div class="card switchPage">
						
						<div class="contentItem upload dpflxr">
							<label for="" class="title">头像：</label>
							<div class="image im">
								<if condition="$info['img'] neq ''"><img src="{$info['img_src']}"></if>
							</div>
							<div class="btn">
								<label for="" id="cc">上传头像</label>
							</div>
							<input name="img" value="{$info['img']}">
						</div>
						<div class="dpflxr">
							<div class="contentItem  dpflxr">
								<label for="" class="title">姓名：</label>
								<input type="text" class="inputBox" name="name" value="{$info['name']}" placeholder="请输入姓名"
									placeholder-style="font-size:16px;line-height:48px;color:#bfa;" />
							</div>
							<div class="contentItem  dpflxr">
								<label for="" class="title">联系方式：</label>
								<input type="text" class="inputBox" name="mobile" value="{$info['mobile']}" placeholder="请输入联系方式"
									placeholder-style="font-size:16px;line-height:48px;color:#bfa;" />
							</div>
							<div class="contentItem  dpflxr">
								<label for="" class="title">性别：</label>
								
								<select name="sex" id="" class="selectBox">
									<option value="1" <if condition="$info['sex'] eq 1">selected</if>>男</option>
									<option value="2" <if condition="$info['sex'] eq 2">selected</if>>女</option>
								</select>
							</div>
							<div class="contentItem  dpflxr" >
								<label for="" class="title">区域：</label>
								
								<select name="province" id="ci" onchange="pp()" class="selectBox" style="width:calc(780px / 3); margin-right: 20px;">
									<option value="">请选择省</option>
									<volist name="province_list" id="item" >
										<option value="{$item['id']}" <if condition="$info['province'] eq $item['id']">selected</if>>{$item['name']}</option>
									</volist>
								</select>
								<select name="city" id="ar" onchange="ccc()" class="selectBox" style="width:calc(780px / 3); margin-right: 20px;">
									<option value="">请选择市</option>
									<volist name="city_list" id="citem">
										<option value="{$citem['id']}" <if condition="$info['city'] eq $citem['id']">selected</if>>{$citem['name']}</option>
									</volist>
								</select>
								<select name="area" id="aaa" class="selectBox" style="width:calc(780px / 3);">
									<option value="">请选择区</option>
									<volist name="area_list" id="aitem">
										<option value="{$aitem['id']}" <if condition="$info['area'] eq $aitem['id']">selected</if>>{$aitem['name']}</option>
									</volist>
								</select>
							</div>
							<div class="contentItem  dpflxr">
								<label for="" class="title">联系地址：</label>
								<input type="text" class="inputBox" name="address" value="{$info['address']}" placeholder="请输入联系地址"
									placeholder-style="font-size:16px;line-height:48px;color:#bfa;" />
							</div>
							<div class="contentItem  dpflxr">
								<label for="" class="title">邮箱：</label>
								<input type="text" class="inputBox" name="email" value="{$info['email']}" placeholder="请输入邮箱地址"
									placeholder-style="font-size:16px;line-height:48px;color:#bfa;" />
							</div>
							<div class="contentItem  dpflxr">
								<label for="" class="title">职业：</label>
								<input type="text" class="inputBox" name="occupation" value="{$info['occupation']}" placeholder="请输入邮箱地址"
									placeholder-style="font-size:16px;line-height:48px;color:#bfa;" />

							</div>
							
							<div class="contentItem  dpflxr">
								<label for="" class="title">状态：</label>
								
								<select name="status" id="" class="selectBox">
									<option value="0" <if condition="$info['status'] eq 0">selected</if>>未审核</option>
									<option value="1" <if condition="$info['status'] eq 1">selected</if>>审核通过</option>
									<option value="2" <if condition="$info['status'] eq 2">selected</if>>审核失败</option>
								</select>
							</div>
							<div class="contentItem  dpflxr">
								<label for="" class="title">身份证号：</label>
								<input type="text" class="inputBox" name="id_number" value="{$info['id_number']}" placeholder="请输入身份证号码"
									placeholder-style="font-size:16px;line-height:48px;color:#bfa;" />
							</div>
						</div>
						<div class="dpflxr">
							<div class="contentItem upload2 dpflxr">
								<label for="" class="title">身份证正面：</label>
								<div class="image pos_rel im1" id="cc1">
									<if condition="$info['id_card_z'] neq ''"><img src="{$info['id_card_z_src']}"></if>
									<div class="icon pos_abs"></div>
								</div>
							</div>
							<input type="hidden" name="id_card_z" value="{$info['id_card_z']}">
							<div class="contentItem upload2 dpflxr">
								<label for="" class="title">身份证反面：</label>
								<div class="image pos_rel im2" id="cc2">
									<if condition="$info['id_card_f'] neq ''"><img src="{$info['id_card_f_src']}"></if>
									<div class="icon pos_abs"></div>
								</div>
							</div>
							<input type="hidden" name="id_card_f" value="{$info['id_card_f']}">
						
						</div>
						<input type="hidden" name="id" value="{$info['id']}">
						<div><button type="submit"  class="ciBtn">确认</button></div>
					</div>
				</form>
			</div>
			
					
			
		</div>
		
		
		
	

		
	</body>
</html>
<script type="text/javascript">
	function pp(){

        var id=$('#ci').val();
        $.ajax({
            url:"{:U('Mechanism/city')}",
            data:{id:id},
            dataType:'json',
            type:'post',
            success:function(data){
            	// console.log(data);return false;
                if(data.result=='1'){
                var tt='<option  value="">请选择市</option>';
                $.each(data.data,function(k,v){
                 tt +='<option value='+v.id+'>'+v.name+'</option>';
                });
                $('#ar').html(tt);
            }
            }
        })

	}

		function ccc(){

        var id=$('#ar').val();
        $.ajax({
            url:"{:U('Mechanism/area')}",
            data:{id:id},
            dataType:'json',
            type:'post',
            success:function(data){
            	// console.log(data);return false;
                if(data.result=='1'){
                var tt='<option  value="">请选择区</option>';
                $.each(data.data,function(k,v){
                 tt +='<option value='+v.id+'>'+v.name+'</option>';
                });
                $('#aaa').html(tt);
            }
            }
        })

	}


$("body").on('click','#cc',function(){
	// alert('123');
    var thisObj = $(this);
    var inputFile = document.createElement("input");
    inputFile.type = "file";
    inputFile.name = "file[]";
    inputFile.multiple = "multiple";
    inputFile.accept = "image/jpeg,image/jpg,image/png";
    inputFile.click();
    $(inputFile).change(function(){
        var files = inputFile.files;
        for(var i=0;i<files.length;i++){
            uploadImg(files[i],thisObj);
        }
    });
});
function uploadImg(file,thisObj){
    var formData = new FormData();
    formData.append('image', file);
    $.ajax({
        url: "{:U('Mechanism/uploadImg')}",
        type: "post",
        data: formData,
        dataType:"json",
        contentType: false,
        processData: false,
        mimeType: "multipart/form-data",
        success: function (data) {
            if(data.code == 0){
            　　console.log(data.info.imgid);
                var imgid=data.info.imgid;
            	$("input[name='img']").val(imgid);
            	var img=data.info.imgurl;
            	$('.im').html('<img src="'+img+'"/>');

　　　　　　　}
        },
    });
}


$("body").on('click','#cc1',function(){
	// alert('123');
    var thisObj = $(this);
    var inputFile = document.createElement("input");
    inputFile.type = "file";
    inputFile.name = "file[]";
    inputFile.multiple = "multiple";
    inputFile.accept = "image/jpeg,image/jpg,image/png";
    inputFile.click();
    $(inputFile).change(function(){
        var files = inputFile.files;
        for(var i=0;i<files.length;i++){
            uploadImg1(files[i],thisObj);
        }
    });
});
function uploadImg1(file,thisObj){
    var formData = new FormData();
    formData.append('image', file);
    $.ajax({
        url: "{:U('Mechanism/uploadImg')}",
        type: "post",
        data: formData,
        dataType:"json",
        contentType: false,
        processData: false,
        mimeType: "multipart/form-data",
        success: function (data) {
            if(data.code == 0){
            　　console.log(data.info.imgid);
                var imgid=data.info.imgid;
            	$("input[name='id_card_z']").val(imgid);
            	var img=data.info.imgurl;
            	$('.im1').html('<img src="'+img+'"/>');

　　　　　　　}
        },
    });
}

$("body").on('click','#cc2',function(){
	// alert('123');
    var thisObj = $(this);
    var inputFile = document.createElement("input");
    inputFile.type = "file";
    inputFile.name = "file[]";
    inputFile.multiple = "multiple";
    inputFile.accept = "image/jpeg,image/jpg,image/png";
    inputFile.click();
    $(inputFile).change(function(){
        var files = inputFile.files;
        for(var i=0;i<files.length;i++){
            uploadImg2(files[i],thisObj);
        }
    });
});
function uploadImg2(file,thisObj){
    var formData = new FormData();
    formData.append('image', file);
    $.ajax({
        url: "{:U('Mechanism/uploadImg')}",
        type: "post",
        data: formData,
        dataType:"json",
        contentType: false,
        processData: false,
        mimeType: "multipart/form-data",
        success: function (data) {
            if(data.code == 0){
            　　console.log(data.info.imgid);
                var imgid=data.info.imgid;
            	$("input[name='id_card_f']").val(imgid);
            	var img=data.info.imgurl;
            	$('.im2').html('<img src="'+img+'"/>');

　　　　　　　}
        },
    });
}
</script>